<?php
require_once("./inc/global.php");
require_once(ADMIN . XG . "System/menusys/function.php");
adminislogin();
function Get_Left_DMenuCount($list){
 	$vlistcount=0;
 	for($vlist=0;$vlist<count($list);$vlist++){
 		if($list[$vlist][2]==0){
 			$vlistcount++;
 		}
 	}
 	return $vlistcount;
 }
 
function Menu_xianshi($MenuID){
	global $db;
	$Data_result=$db->getoners("select * from menusys wheremenusys0=($MenuID)");
	$DataConfig=$Data_result[5];
	$DataConfigArr=explode(",",$DataConfig);
}

function Menu_xiaShow($MenuDateList,$id){
	for($j=0;$j<count($MenuDateList);$j++){
		if($MenuDateList[$j][2]==$id&&$MenuDateList[$j][9]==0){
			return true;
		}
	}
	return false;
}


function left_MenuList($MenuDateList,$id,$gang=1){
	$MenuDateList_count=count($MenuDateList);
	if(is_array($MenuDateList)){
		for($i=0;$i<$MenuDateList_count;$i++){  //一级
			if($MenuDateList[$i][2]==0 && Menu_xiaShow($MenuDateList,$MenuDateList[$i][0])){
			echo "<div align=\"left\" id=\"menushowgang{$gang}\"><table width=\"100%\" border=\"0\" onclick=\"Menu_Tab('System_Child_',$id,{$gang})\" cellpadding=\"0\" cellspacing=\"0\" style=\" cursor:hand; margin-top:1px;\"><tr><td class=\"menu_1\" style='text-align:left; font-size:12px; color:#cfd3d9'>&nbsp;<img src=\"iamges/b.png\" width=\"8\" height=\"6\" />&nbsp;{$MenuDateList[$i][1]}</td></tr></table></div>";
    			echo "<div id=\"System_Child_{$gang}\" style=\"display:none\" class=\"child\">";
    			for($j=0;$j<=$MenuDateList_count;$j++){  //二级
					if(isset($MenuDateList[$j][2]) && isset($MenuDateList[$i][0])){
    				if($MenuDateList[$j][2]==$MenuDateList[$i][0])
    				{
    					if($MenuDateList[$j][9]==0 && (isGetRule($MenuDateList[$j][0],$_SESSION[ADMINSESSION][0],1) || strtolower($_SESSION[ADMINSESSION][1])=='admin')){
							//echo ;
							if($MenuDateList[$j][10]=="#" || empty($MenuDateList[$j][10]))
							{
								 echo "<table width=\"115\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"margin-top:3px;\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td height=\"12\" align=\"left\"><img src=\"iamges/a.png\" width=\"4\" height=\"8\" />&nbsp;<a href=\"javascript:;\" ><span class=\"Menu12W\">{$MenuDateList[$j][1]}</span></a></td></tr></table></td></tr></table>";
							}else{
								 echo "<table width=\"120\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"margin-top:3px;\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td height=\"12\" align=\"left\">&nbsp;<img src=\"iamges/a.png\" width=\"4\" height=\"8\" />&nbsp;<a href=\"{$MenuDateList[$j][10]}?MenuID={$MenuDateList[$j][0]}\" target=\"mainFrame\" ><span class=\"Menu12W\">{$MenuDateList[$j][1]}</span></a></td></tr></table></td></tr></table>";
							}
				  
				  			for($k=0;$k<$MenuDateList_count;$k++){  //三级
								if(isset($MenuDateList[$k][2]) && isset($MenuDateList[$j][0])){
								if($MenuDateList[$k][2]==$MenuDateList[$j][0]){
									
									if($MenuDateList[$k][9]==0 && (isGetRule($MenuDateList[$k][0],$_SESSION[ADMINSESSION][0],1) || strtolower($_SESSION[ADMINSESSION][1])=='admin')){
										
										

										if($MenuDateList[$k][10]=="#" || empty($MenuDateList[$k][10]))
										{
										echo " <table width=\"115\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"margin-top:3px; margin-left:20px;\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td height=\"12\" align=\"left\"><img src=\"iamges/a.png\" width=\"4\" height=\"8\" />&nbsp;<a href=\"javascript:;\" ><span class=\"Menu12W\">{$MenuDateList[$k][1]}</span></a></td></tr></table></td></tr></table>";
									  }else{
										  echo "<table width=\"120\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"margin-top:3px; margin-left:20px;\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td height=\"12\" align=\"left\"><img src=\"iamges/a.png\" width=\"4\" height=\"8\" />&nbsp;<a href=\"{$MenuDateList[$k][10]}?MenuID={$MenuDateList[$k][0]}\" target=\"mainFrame\" ><span class=\"Menu12W\">{$MenuDateList[$k][1]}</span></a></td></tr></table></td></tr></table>";  
									  }
									  for($l=0;$l<$MenuDateList_count;$l++){  //四级
										 if(isset($MenuDateList[$l][2]) && isset($MenuDateList[$k][0])){
									  	if($MenuDateList[$l][2]==$MenuDateList[$k][0]){
											if($MenuDateList[$l][9]==0 && (isGetRule($MenuDateList[$l][0],$_SESSION[ADMINSESSION][0],1) || strtolower($_SESSION[ADMINSESSION][1])=='admin')){
												echo " <table width=\"115\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"margin-top:3px;margin-left:30px;\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td height=\"12\" align=\"left\">&nbsp;<img src=\"iamges/a.png\" width=\"4\" height=\"8\" />&nbsp;<a href=\"{$MenuDateList[$l][10]}?MenuID={$MenuDateList[$l][0]}\" target=\"mainFrame\" ><span class=\"Menu12W\">{$MenuDateList[$l][1]}</span></a></td></tr></table></td></tr></table>";
											
											}
									  
										}
										}
										
									  }
									}
										
									}
									
								}
							
							}
				  
    					}
    				}
				}
    			}
			echo "</div>";
			$gang++;
			}
			
		}
		echo '<script type="text/javascript">for(var i=1;i<'.$gang.';i++){if(document.getElementById("System_Child_"+i).innerHTML.length<10){document.getElementById("menushowgang"+i).style.display="none";}}</script>';
	}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台栏目管理</title>
<style type="text/css">
body {margin-right: 0px;margin-left: 0px;margin-top: 0px;margin-bottom: 0px;}
</style>
<script type="text/javascript">function getid(s){return (typeof s=='object')?s:document.getElementById(s);}function Menu_Tab(a,b,c){for(var i=1;i<=b;i++){if(i==c){getid(a+i).style.display!=""?getid(a+i).style.display="":getid(a+i).style.display="none";}else{getid(a+i).style.display="none";}}}</script>
<link href="Css.css" rel="stylesheet" type="text/css">
</head>
<body ondragstart="return false" onselectstart="return false">
<table width="100%" height="460" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" bgcolor="#6f7783">
<div id="leftscroll" class="leftmunulist" style="width:140px;overflow-x:hidden; overflow-y:auto; height:100%;"><?php
            $result=$db->query("select * from menusys order by menusys3 asc");
            $MenuDateList=$db->GetDatalist($result);
            left_MenuList($MenuDateList,Get_Left_DMenuCount($MenuDateList),1);
            ?><br></div></td></tr></table></td></tr></table>
       <script type="text/javascript">
       getid('leftscroll').style.height=document.documentElement.scrollHeight+'px';
       </script>
            
       </body></html>
